package cn.tedu.pethospital.user.controller;

import cn.tedu.pethospital.base.response.JsonResult;
import cn.tedu.pethospital.user.pojo.dto.UserLoginParam;
import cn.tedu.pethospital.user.pojo.vo.UserVO;
import cn.tedu.pethospital.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/v1/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("login")
    public JsonResult login(@RequestBody UserLoginParam user){
        log.debug("用户登录，参数：{}",user);
        UserVO userVO = userService.login(user);
        log.debug("用户登录，结果：{}",userVO);
        return JsonResult.ok(userVO);
    }
}
